﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CPlatePrintSys.Infrastructure.Models;
using Prism.Mvvm;

namespace CPlatePrintSys.Win.ViewModels
{
    public class MaterialManageViewModel : BindableBase
    {
        #region properties
        private string _subTitle = string.Empty;
        public string SubTitle
        {
            get { return _subTitle; }
            set { SetProperty(ref _subTitle, value); }
        }


        private ObservableCollection<MaterialManagementModel> _materialManagementModels;
        public ObservableCollection<MaterialManagementModel> MaterialManagementModels
        {
            get { return _materialManagementModels; }
            set { SetProperty(ref _materialManagementModels, value); }
        }

        private ObservableCollection<MaterialManagementModel> _selectedMaterialModels;
        public ObservableCollection<MaterialManagementModel> SelectedMaterialModels
        {
            get { return _selectedMaterialModels; }
            set
            {
                SetProperty(ref _selectedMaterialModels, value);
                // Notify that the button's enabled state might change
                OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsButtonEnabled)));
            }
        }

        public bool IsButtonEnabled
        {
            get { return SelectedMaterialModels != null && SelectedMaterialModels.Count > 0; }
        }

        #endregion

        public MaterialManageViewModel()
        {
            _subTitle = "发注资料";
            _materialManagementModels = new ObservableCollection<MaterialManagementModel>
        {
            new MaterialManagementModel(
                1, "N1159", "A", "AP1_HB3", "A01A",
                new DateTime(2024, 5, 22), "7PA001", "A01A7PA001",
                "A", 20, 1849, 5599,
                "A", 20, 1849, 5599,
                "A01A7PA001/A01A7PA002", "套料代", "6049"),

            new MaterialManagementModel(
                2, "N1159", "A", "AP1_HB3", "A01A",
                new DateTime(2024, 5, 23), "7PA002", "A01A7PA001",
                "A", 20, 1849, 5599,
                "A", 20, 1849, 5599,
                "A01A7PA001/A01A7PA002", "套料代", "6050"),

            new MaterialManagementModel(
                3, "N1159", "A", "AP1_HB3", "A01B",
                new DateTime(2024, 5, 24), "7PA013", "A01B7PA001",
                "A", 20, 1849, 5599,
                "A", 20, 1849, 5599,
                "A01B7PA001/A01B7PA002", "套料代", "6051"),

            new MaterialManagementModel(
                4, "N1159", "B", "AP1_HB4", "B01A",
                new DateTime(2024, 5, 25), "7PA022", "B01A7PA001",
                "B", 25, 2000, 6000,
                "B", 25, 2000, 6000,
                "B01A7PA001/B01A7PA002", "套料代", "6052"),

            new MaterialManagementModel(
                5, "N1159", "B", "AP1_HB4", "B01B",
                new DateTime(2024, 5, 26), "7PA025", "B01B7PA001",
                "B", 25, 2000, 6000,
                "B", 25, 2000, 6000,
                "B01B7PA001/B01B7PA002", "套料代", "6053"),

            new MaterialManagementModel(
                6, "N1160", "C", "AP1_HB5", "F01A",
                new DateTime(2024, 5, 27), "7PA043", "F01A7PA001",
                "C", 30, 2200, 6500,
                "C", 30, 2200, 6500,
                "F01A7PA001/F01A7PA002", "套料代", "6054"),

            new MaterialManagementModel(
                7, "N1160", "C", "AP1_HB5", "F01B",
                new DateTime(2024, 5, 28), "7PA052", "F01B7PA001",
                "C", 30, 2200, 6500,
                "C", 30, 2200, 6500,
                "F01B7PA001/F01B7PA002", "套料代", "6055"),

            new MaterialManagementModel(
                8, "N1160", "D", "AP2_HB3", "G01A",
                new DateTime(2024, 5, 29), "7PA058", "G01A7PA001",
                "D", 35, 2400, 7000,
                "D", 35, 2400, 7000,
                "G01A7PA001/G01A7PA002", "套料代", "6056"),


            new MaterialManagementModel(
                9, "N1160", "C", "AP1_HB5", "F01B",
                new DateTime(2024, 5, 28), "7PA052", "F01B7PA001",
                "C", 30, 2200, 6500,
                "C", 30, 2200, 6500,
                "F01B7PA001/F01B7PA002", "套料代", "6055"),
            new MaterialManagementModel(
                10, "N1160", "C", "AP1_HB5", "F01B",
                new DateTime(2024, 5, 28), "7PA052", "F01B7PA001",
                "C", 30, 2200, 6500,
                "C", 30, 2200, 6500,
                "F01B7PA001/F01B7PA002", "套料代", "6055"),
            new MaterialManagementModel(
                11, "N1160", "C", "AP1_HB5", "F01B",
                new DateTime(2024, 5, 28), "7PA052", "F01B7PA001",
                "C", 30, 2200, 6500,
                "C", 30, 2200, 6500,
                "F01B7PA001/F01B7PA002", "套料代", "6055"),
            new MaterialManagementModel(
                12, "N1160", "C", "AP1_HB5", "F01B",
                new DateTime(2024, 5, 28), "7PA052", "F01B7PA001",
                "C", 30, 2200, 6500,
                "C", 30, 2200, 6500,
                "F01B7PA001/F01B7PA002", "套料代", "6055"),
            new MaterialManagementModel(
                13, "N1160", "C", "AP1_HB5", "F01B",
                new DateTime(2024, 5, 28), "7PA052", "F01B7PA001",
                "C", 30, 2200, 6500,
                "C", 30, 2200, 6500,
                "F01B7PA001/F01B7PA002", "套料代", "6055"),
            new MaterialManagementModel(
                14, "N1160", "C", "AP1_HB5", "F01B",
                new DateTime(2024, 5, 28), "7PA052", "F01B7PA001",
                "C", 30, 2200, 6500,
                "C", 30, 2200, 6500,
                "F01B7PA001/F01B7PA002", "套料代", "6055"),
            new MaterialManagementModel(
                15, "N1160", "C", "AP1_HB5", "F01B",
                new DateTime(2024, 5, 28), "7PA052", "F01B7PA001",
                "C", 30, 2200, 6500,
                "C", 30, 2200, 6500,
                "F01B7PA001/F01B7PA002", "套料代", "6055")
            };
        }
    }
}
